<div id="tl_buttons">
	<a title="Go back" class="header_back" href="typolight/main.php?do=orderlist&act=detail&id=<?php echo $this->Input->get('id_order'); ?>">Go back</a>
</div>
<div class="order_invoice">
	<div class="tl_leftcolumn">
	</div>
	<div class="tl_rightcolumn">
		<div class="member_info">
			<p><strong><?php echo $this->orderDetails[0]['firstname']; ?> <?php echo $this->orderDetails[0]['lastname']; ?>,</strong><br />
					<?php echo $this->orderDetails[0]['shippingAddr']; ?> 
					<?php echo (($this->orderDetails[0]['shippingAddr2']=="line 2" || $this->orderDetails[0]['shippingAddr2']=="Address line 2") ? "" : "<br />".$this->orderDetails[0]['shippingAddr2']) . ", ".(($this->arrCitys[$this->orderDetails[0]['city']]&&$this->orderDetails[0]['country']=='cn') ? $this->arrCitys[$this->orderDetails[0]['city']] : $this->orderDetails[0]['city']) . "<br />" . (($this->arrStates[$this->orderDetails[0]['state']]&&$this->orderDetails[0]['country']=='cn') ? $this->arrStates[$this->orderDetails[0]['state']] : $this->orderDetails[0]['state']) . "&nbsp;" . $this->orderDetails[0]['postcode'] ."&nbsp;". $this->arrCountries[$this->orderDetails[0]['country']]; ?><?php if ($this->orderDetails[0]['telephone']): ?><br />Tel: <?php echo $this->orderDetails[0]['telephone'] ?><?php endif; ?><?php if ($this->orderDetails[0]['cellphone']): ?><br />MP: <?php echo $this->orderDetails[0]['cellphone']; ?><?php endif; ?></p>
		</div>
		<div class="head_date"><?php echo date('d F Y', strtotime($this->orderDetails[0]['placed_time'])); ?></div>
		<h2 class="order">ORDER <small>#<?php echo $this->orderDetails[0]['orderno']; ?></small></h2>
		<div class="order_summery">
			<?php 
					$catalogFree = 0.00;
					$shippingFree = $this->orderDetails[0]['shippingFree'];
					$total_discounts = $this->orderDetails[0]['total_discounts'];
					
					$index = 0;
					if ($this->orderDetails)
					{
						?>
							<table class="cart_item">
							<tr>
								<th class="name" style="vertical-align:middle;">Item ID & Name</th>
								<th class="color" style="vertical-align:middle;">Color</th>
								<th class="size" style="vertical-align:middle;">Size</th>
								<th class="qty" style="vertical-align:middle;">Qty</th>
								<th class="price" style="vertical-align:middle;">Price</th>
								<th class="subtotal" style="vertical-align:middle;">Subtotal</th>
							</tr>
						<?php
						foreach ($this->orderDetails as $arrorderDetails)
						{			
							$unitWrapping = $arrorderDetails['wrapping_price'];
							$wrappingTotal += $unitWrapping;
							if ($arrorderDetails['is_wrapping'])
								$detailTotal = number_format((($arrorderDetails['odrPrice'] + $unitWrapping) * $arrorderDetails['prod_quantity']), 2, '.', '');
							else
								$detailTotal = number_format(($arrorderDetails['odrPrice'] * $arrorderDetails['prod_quantity']), 2, '.', '');
							
							$catalogFree += $detailTotal;
						?>
							<tr>
								<td class="name" style="vertical-align:middle;">#<?php echo $arrorderDetails['skuid']; ?><br /><?php echo $arrorderDetails['catalogName']; ?></td>
								<td class="color" style="vertical-align:middle;"><?php echo $arrorderDetails['colorName']; ?></td>
								<td class="size" style="vertical-align:middle;"><?php echo $arrorderDetails['sizeName']; ?></td>
								<td class="qty" style="vertical-align:middle;"><?php echo $arrorderDetails['prod_quantity']; ?></td>
								<td class="price" style="vertical-align:middle;"><?php echo $this->obj_currency->change_order($arrorderDetails['odrPrice'],$arrorderDetails['iso_code']); ?></td>
								<td class="subtotal" style="vertical-align:middle;"><?php if ($unitWrapping > 0): ?><?php echo $this->obj_currency->change_order($detailTotal,$arrorderDetails['iso_code']); ?><?php else: echo $this->obj_currency->change_order($detailTotal,$arrorderDetails['iso_code']); ?><?php endif; ?></td>
							</tr>
						<?php
							$index++;
						}
						?>
						<?php if ($this->orderDetails): ?>
							<?php if ($arrorderDetails['is_wrapping']): ?>
							<tr>
								<td colspan="6" class="wrapping">WRAPPING: <?php echo $this->obj_currency->change_order($arrorderDetails['total_wrapping'],$arrorderDetails['iso_code']); ?></td>
							</tr>
							<?php endif; ?>
							<tr>
								<td colspan="6" class="standard">SHIPPING: <?php echo ($shippingFree == 25) ? 'SAME DAY DELIVERY (SHANGHAI ONLY)' : 'STANDARD'; ?> <?php echo $this->obj_currency->change_order($shippingFree,$arrorderDetails['iso_code']); ?></td>
							</tr>
							<?php if ($total_discounts > 0): ?>
							<tr>
								<td colspan="6" class="discount">DISCOUNT: -<?php echo $this->obj_currency->change_order($total_discounts,$arrorderDetails['iso_code']); ?></td>
							</tr>
							<?php endif; ?>
						</table>
						<?php endif; ?>
					<?php
					}
					?>
		</div>
		<div class="total_price">
			<small>TOTAL:</small>
			<span><?php echo $this->obj_currency->change_order(($catalogFree + $shippingFree - $total_discounts),$arrorderDetails['iso_code']); ?></span>
		</div> <!-- total_price end -->
		<?php if (str_replace("\n", "<br />", $arrorderDetails['comments']) != 'FOR EXAMPLE: PLEASE DELIVER BETWEEN 7 AND 9PM IN THE EVENING' && str_replace(" ", "", $arrorderDetails['comments']) != "" && str_replace("\n", "", $arrorderDetails['comments']) != "" && $arrorderDetails['comments'] != ""): ?>
		<div class="order_comments">
			<h3>COMMENT or Special Request:</h3>
			<p>
				<?php echo str_replace("\n", "<br />", $arrorderDetails['comments']); ?>
			</p>
		</div><!-- order comments -->
		<?php endif; ?>
		<div class="greet">
			<img class="footer_logo" src="../../../images/footer_logo.gif" alt="daftshopping.com" />
            <p><br /><br />CLIENT SIGNATURE:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DATE:<br />
<br />
</p>
			<p>Thank you for your shopping with daftshopping.com. </p>
			<p><small>For help with any of our online services, please contact our Customer Service Department Monday to Saturday via email: orders@daftshopping.com</small></p>
		</div>
		<div class="footer">
			<strong>daft</strong>shopping.com
		</div>
	</div>
</div>